home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / installit next >
Encoding:
Text File  |  1990-02-28  |  1.3 KB  |  85 lines

  1. #! /bin/sh
  2. #
  3. #    '@(#)installit    2.4    10/15/87'
  4. #    From install.sh    4.8    (Berkeley)    3/6/86
  5. #    on the 4.3 BSD distribution (with permission)
  6. #
  7. PATH=/bin:/etc:/usr/bin:/usr/ucb
  8. export PATH
  9. cmd=""
  10. stripbefore=""
  11. stripafter=""
  12. chmod="chmod 755"
  13. chown="#"
  14. chgrp="#"
  15. while true ; do
  16.     case $1 in
  17.         -s )    if test $cmd 
  18.             then    stripafter="strip"
  19.             else    stripbefore="strip"
  20.             fi
  21.             shift
  22.             ;;
  23.         -c )    if test $cmd 
  24.             then    echo "install: multiple specifications of -c"
  25.                 exit 1
  26.             fi
  27.             cmd="cp"
  28.             stripafter=$stripbefore
  29.             stripbefore=""
  30.             shift
  31.             ;;
  32.         -m )    chmod="chmod $2"
  33.             shift
  34.             shift
  35.             ;;
  36.         -o )    chown="chown $2"
  37.             shift
  38.             shift
  39.             ;;
  40.         -g )    chgrp="chgrp $2"
  41.             shift
  42.             shift
  43.             ;;
  44.         * )    break
  45.             ;;
  46.     esac
  47. done
  48. if test $cmd 
  49. then true
  50. else cmd="mv"
  51. fi
  52.  
  53. if test ! ${2-""} 
  54. then    echo "install: no destination specified"
  55.     exit 1
  56. fi
  57. if test ${3-""} 
  58. then    echo "install: too many files specified -> $*"
  59.     exit 1
  60. fi
  61. if test $1 = $2 -o $2 = . 
  62. then    echo "install: can't move $1 onto itself"
  63.     exit 1
  64. fi
  65. if test '!' -f $1 
  66. then    echo "install: can't open $1"
  67.     exit 1
  68. fi
  69. if test -d $2 
  70. then    file=$2/`basename $1`
  71. else    file=$2
  72. fi
  73. /bin/rm -f $file
  74. if test $stripbefore 
  75. then    $stripbefore $1
  76. fi
  77. $cmd $1 $file
  78. if test $stripafter 
  79. then    $stripafter $file
  80. fi
  81. $chown $file
  82. $chgrp $file
  83. $chmod $file
  84. exit 0
  85.